Counters are used to count events for processes that are being monitored. The occurrence of an event causes a “tick” on an event clock signal that is counted by a counter. The final count of ticks in the counter is used for purposes such as data logging, control, diagnostics and the like. Exceeding the counting range of the counter causes counter overflow, which can often lead to loss of data from the counter. The incidence of overflow conditions can be reduced by using a larger counter: however, the larger counter typically consumes more layout area and power, and can slow the maximum speed of operation of the counter. The incidence of overflow can be also reduced by using a prescaler to reduce the number of ticks presented to the counter.
Counter prescalers are typically dividers used to scale the event clock input of a counter, which uses the existing range of the counter to count more clicks (indications) although at the expense of reducing precision. The prescalers typically have a “divide by” value that is selected such that the expected amount of counted events does not exceed the counting range of the counter. When the nature and expected frequency of events is known beforehand, a prescaler can be set such that counter overflows are typically avoided. However, in many situations that the nature and expected frequency of events can vary considerably from what is expected, and the prescaler is often set to a non-optimum value so as to avoid loss of data (at the expense of precision, for example). If the prescaler value is set too low, a counter overflow may occur. If the prescaler value is set too high, the final count of the counter might not have sufficient precision to provide meaningful data in some applications.